// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'
// import ModelGroup from '../views/modelGroup/modelGroup.vue'
const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    redirect: '/servdesk/default',
    children: [
      // 服务台
      {
        path: '/servdesk',
        name: 'default',
        redirect: '/servdesk/default',
        component: RouteView,
        meta: { title: 'menu.servdesk', keepAlive: true, icon: bxAnaalyse, permission: ['servdesk'] },
        children: [
          {
            // 默认视图
            path: '/servdesk/default',
            name: 'Workplace',
            component: () => import('@/views/servdesk/Default'),
            meta: { title: 'menu.servdesk.default', keepAlive: true, permission: ['servdesk'] }
          },

          {
            // demo
            path: '/servdesk/demo',
            name: 'workDeom',
            component: () => import(/* webpackChunkName: "workDemo" */ '@/views/demo/Demo'),
            meta: { title: 'menu.servdesk.demo', keepAlive: true, permission: ['servdesk'] }
          }
        ]
      },

      // result
      {
        path: '/result',
        name: 'result',
        component: RouteView,
        redirect: '/result/success',
        meta: { title: 'menu.result', icon: 'check-circle-o', permission: ['result'] },
        children: [
          {
            path: '/result/success',
            name: 'ResultSuccess',
            component: () => import(/* webpackChunkName: "result" */ '@/views/result/Success'),
            meta: { title: 'menu.result.success', keepAlive: false, hiddenHeaderContent: true, permission: ['result'] }
          },
          {
            path: '/result/fail',
            name: 'ResultFail',
            component: () => import(/* webpackChunkName: "result" */ '@/views/result/Error'),
            meta: { title: 'menu.result.fail', keepAlive: false, hiddenHeaderContent: true, permission: ['result'] }
          }
        ]
      },

      // Exception
      {
        path: '/exception',
        name: 'exception',
        component: RouteView,
        redirect: '/exception/403',
        meta: { title: 'menu.exception', icon: 'warning', permission: ['exception'] },
        children: [
          {
            path: '/exception/403',
            name: 'Exception403',
            component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
            meta: { title: 'menu.exception.not-permission', permission: ['exception'] }
          },
          {
            path: '/exception/404',
            name: 'Exception404',
            component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
            meta: { title: 'menu.exception.not-find', permission: ['exception'] }
          },
          {
            path: '/exception/500',
            name: 'Exception500',
            component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
            meta: { title: 'menu.exception.server-error', permission: ['exception'] }
          }
        ]
      }
      // account
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/system',
    component: UserLayout,
    // redirect: '/system/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "system" */ '@/views/system/Login'),
        meta: { title: '登录' }
      }
    ]
  },

  {
    path: '/demo',
    name: 'demo',
    component: () => import(/* webpackChunkName: "Demo" */ '@/views/demo/Demo'),
    meta: { title: 'demo' }
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
  // {
  //   path: '/modelGroup',
  //   component: ModelGroup,
  //   redirect: '/modelGroup'
  // }
]
